/*
 * @Author: 张瑞
 * @Date: 2021-08-31 16:38:51
 * @LastEditors: huangl
 * @LastEditTime: 2022-01-10 15:56:30
 * @Description: file content
 * @FilePath: \vue2xComponents\src\main.js
 */
import Vue from 'vue'
import App from '@/App.vue'
import store from '@/store'
import core from '@/plugins/core.js'
import remJs from '../customConfiguration/rem.js';
import { sync } from "vuex-router-sync"
import toast from '@/components/toast'
import VueI18n from 'vue-i18n';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'


Vue.prototype.$ELEMENT = {
    size: 'small',
    zIndex: 3000
}
Vue.config.devtools = true;
// 取消 Vue 所有的日志与警告。
Vue.config.silent = true;
// vue3.0 删除该api
Vue.config.keyCodes = {
    // 取而代之的是 kebab-case 且用双引号括起来
    "media-play-pause": 179
}
Vue.config.silent = true
Vue.use(remJs)
Vue.use(core)
Vue.use(toast)
Vue.use(VueI18n)
const i18n = new VueI18n({
    locale: 'en-US',    // 语言标识
    //this.$i18n.locale // 通过切换locale的值来实现语言切换
    messages: {
        'zh-CN': {
            message: {
                hello: '好好学习，天天向上！',
                themeColor: '主题色',
                ...zhLocale // 或者用 Object.assign({ message: '你好' }, zhLocale)
            }
        }, // 中文语言包
        'en-US': {
            message: {
                hello: 'good good study, day day up!',
                themeColor: 'theme-color',

            },
            ...enLocale, // 或者用 Object.assign({ message: 'hello' }, enLocale)
            // el: {
            //     datepicker: {
            //         year: '月'
            //     }
            // }
        }  // 英文语言包
    }
})
Vue.use(ElementUI, {
    i18n: function (path, options) {
        return i18n.t(path)
    }
});



Vue.config.productionTip = false;
const createVue = (router) => {
    sync(store, router)
    new Vue({
        router,
        i18n,
        store,
        render: h => h(App)
    }).$mount('#app')
}
export default createVue